#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Author  :   JingV
@Version :   1.0
@Contact :   None
@License :   None
@Desc    :   None
'''


class Solution(object):
    def isNumber(self, s):
        s = s.strip()
        import re
        pattern = r'^[+-]?(\.\d+|\d+\.?(\d+)?)([eE][+-]?\d+)?$'
        result = re.match(pattern, s)
        if result:
            return True
        #pattern = r'^[+-]?\.\d+([eE][+-]?\d+)?$'
        #result = re.match(pattern, s)
        #if result:
        #    return True
        return False


def main():
    solution = Solution()
    tests = [".1", "1.1", "1.", "+100", "1.e2", "-123", "3.1416", "-1E-16", "0123", "12e", "1a3.14", "1.2.3", "+-5", "12e+5.4", "e1 "]
    for index, num in enumerate(tests):
        if index == 9:
            print('------blow should return false-----')
        print(solution.isNumber(num))


if __name__ == "__main__":
    main()





